package com.xuecheng.ucenter.feign;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author achao
 * @version 1.0
 */
@Component
@Slf4j
public class CheckCodeFactory implements FallbackFactory<CheckCodeFeignClient> {
    @Override
    public CheckCodeFeignClient create(Throwable throwable) {

        CheckCodeFeignClient checkCodeFeignClient = new CheckCodeFeignClient() {

            @Override
            public Boolean verify(String key, String code) {
                log.error("调用验证码服务发生熔断,key:{},code:{}", key, code);
                return null;
            }

        };
        return checkCodeFeignClient;
    }
}
